<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
    <!--
    .style1 {
        font-size: 24px;
        font-weight: bold;
    }
    -->
</style>
<script src="<?=PATH?>/soanthao/fckeditor.js"></script>
<script>
    onload=function()
    {
        a=new FCKeditor('noidungtin');
        a.BasePath="<?=PATH?>/soanthao/";
        a.Width="800";
        a.Height="600";
        a.ReplaceTextarea();
    }
</script>
<script>
    function OpenWindow(theURL,winName,features)
    {
        window.open(theURL,winName,features);
    }
</script>
<script>
    function ftindang()
    {
        re=/^ *$/;
        with(frmnewsdetail)
        {
            if(re.test(tieude.value))
            {
                alert("Cần điền tiêu đề");
                tieude.value="";
                tieude.focus();
                return false;
            }


        }
    }
</script>




<div class="Main_Header" align="center">Đăng tin</div>
<form enctype="multipart/form-data" name="frmnewsdetail" method="post" action="">
    <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
        <tr>
            <th width="40%" align="left">Tiêu đề tin: </th>
            <td colspan="2" align="left"><label>
                <input name="tieude" type="text" id="tieude" size="60">
            </label></td>
        </tr>
        <tr>
            <th width="24%" align="left">Tóm tắt tin </th>
            <td colspan="2" align="left"><label>
                <textarea rows="4" cols="100" name="tomtat" ></textarea>
            </label></td>
        </tr>
        <tr>
            <th rowspan="1" align="left">Ảnh:  </th>

            <td width="70%" rowspan="1" align="center" colspan="2">Tải ảnh mới: <br />
                <?
                $data ="../media/images/news/";
                $max_size = "10000000";
                $max_file ="1";
                $file_name=time().'_';
                ?>
            <p>Ch&#7885;n  &#7843;nh &#273;&#7875; upload:
                <input type='file' name='f1' onchange="frmnewsdetail.upload.disabled=false;" />
                <input type='submit' name='upload' value='Upload' style='height:30px; width:80px;' onclick="return fhinhanhthem();" disabled="disabled" />
                <br />
                <?

                if($_REQUEST["upload"]=="Upload")
                {
                    $a = $_FILES["f1"]["tmp_name"];
                    $b = $_FILES["f1"]["name"];
                    $d = $_FILES["f1"]["size"];
                    $c = substr($b,strlen($b)-3,3);
                    if($d>$max_size)
                    {
                        echo("Dung l&#432;&#7907;ng gi&#7899;i h&#7841;n là $max_size KB. File <b>{$b}</b> &#273;ã v&#432;&#7907;t quá gi&#7899;i h&#7841;n cho phép <br>");
                    }
                    else
                    {
                        if($c=="jpg"||$c=="jpeg"||$c=="gif"||$c=="bmp"||$c=="png")
                        {
                            $tenfile = $file_name.$b;
                            move_uploaded_file($a,$data.$tenfile);
                            ?>
                            <br />
</p>
	  <img src='<?=PATH?>/media/images/news/<?=$tenfile?>' width=100 height=120 border="1" /><br />
                            <br />
                            <?
                        }
                    }
                }
                ?>
                <input type="hidden" name='anh' value='<?=$tenfile?>'/><?=$tenfile?>	  </td>
        </tr>


        <tr>
        <th align="left" width="200px">Trạng thái: </th>
        <td colspan="2" align="left">

                <label>
                <input type="radio" checked="checked" name="trangthaitin" value="1"> Hiện</label> <label><input type="radio" name="trangthaisp" value="0"> Ẩn</label>


      	</td>
        </tr>
        <tr>
            <th align="rleft" valign="middle">Nội dung tin </th>
            <td colspan="2" align="left"><label>
                <textarea name="noidungtin" id="noidungtin" style="border: 1px #c0c0c0 solid"></textarea>
            </label></td>
        </tr>



        <tr>
            <td align="left">&nbsp;</td>
            <td colspan="2" align="center" class="button">
                <input type="submit" name="dangtin" value="Đăng tin" onclick="return ftindang();">
                <input type="reset" name="Submit3" value="Làm lại" />


                <input type="button" name="Submit2" value="Trang tin" onclick="location='/mymvc/administrator/news'">
            </td>
        </tr>
    </table>
</form>
